package day12.throws_;

import java.io.FileInputStream;
import java.io.FileNotFoundException;

public class ThrowsDetail {
    public static void main(String[] args) {
        f2();
    }

    public static void f1() throws FileNotFoundException {
        f3();
    }
    public static void f2() /*throws ArithmeticException，这里默认自带了throws*/{
        int n1 = 10;
        int n2 = 0;
        double res = n1 / n2;
    }
    public static void f3() throws FileNotFoundException {
        FileInputStream fis = new FileInputStream("d://aa.txt");
    }
}

class Father {
    public void method() throws Exception{}
}
class Son extends Father{
    @Override
    //子类重写父类的方法时，对抛出异常的规定:子类重写的方法，
    //所抛出的异常类型要么和父类抛出的异常一致，要么为父类抛出的异常类型的子类型
    //在throws 过程中，如果有方法 try-catch , 就相当于处理异常，就可以不必throws
    public  void method() throws ArithmeticException{}
}